#!/bin/bash

# 运算偶数行的值减去前一行的值，输出最大值
line_num=0
var1=0
var2=0
result=0
max_result=0
while read line
do
	line_num=`expr $line_num + 1`
	if [ $(($line_num%2)) == 1 ]
	then
		var1=$line
	else
		result=`expr $line - $var1`
		#echo $result
		if [ $result -gt $max_result ]
		then
			max_result=$result
		fi
	fi
done < $1
echo "max_result: "$max_result
